package com.jiukuaidao.zhulin.module.order;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiukuaidao.library.base.BaseActivity;
import com.jiukuaidao.library.common.dialog.CommDialog;
import com.jiukuaidao.library.common.dialog.ICallBack;
import com.jiukuaidao.zhulin.R;
import com.jiukuaidao.zhulin.data.TaskProvider;
import com.jiukuaidao.zhulin.module.order.contract.ComplaintContract;
import com.jiukuaidao.zhulin.module.order.presenter.ComplaintPresenter;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Author : BinarySatan
 * Date : 2016/6/6
 * Description : 投诉页面
 */
public class ComplaintActivity extends BaseActivity<ComplaintContract.Presenter> implements ComplaintContract.View {

    @BindView(R.id.titile_left_imageview)
    ImageView mTitileLeftImageview;
    @BindView(R.id.titile_text)
    TextView mTitileText;
    @BindView(R.id.titile_right_text)
    TextView mTitileRightText;
    @BindView(R.id.content_layout_title)
    RelativeLayout mContentLayoutTitle;

    @BindView(R.id.et_complaint_content)
    EditText mEtComplaintContent;
    @BindView(R.id.btn_submit)
    Button mBtnSubmit;


    private String mOrderId;

    @Override
    protected View getTargetView() {
        return null;
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_order_complaint;
    }

    @Override
    protected void handleBundle(Bundle bundle) {
        mOrderId = bundle.getString("orderNumber");
    }

    @OnClick(R.id.btn_submit)
    public void clickSubmitComplaint() {
        mPresenter.submitComplaint();
    }

    @Override
    protected void init() {
        mTitileText.setText(getString(R.string.complaints));

        new ComplaintPresenter(TaskProvider.provideTasksRepository(this), this);
    }

    @OnClick(R.id.titile_left_imageview)
    public void clickBack() {
        this.finish();
    }

    @Override
    public String getOrderId() {
        return mOrderId;
    }

    @Override
    public String getComplaintContent() {
        return mEtComplaintContent.getText().toString().trim();
    }

    @Override
    public void complaintSuc() {

        showDialogOneBtn("投诉已经提交客服，我们会尽快处理.", new ICallBack.OneCallBack() {
            @Override
            public void confirm(CommDialog dialog) {
                ComplaintActivity.this.finish();
            }
        });
    }
}
